﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CaiyinSoft.NetGather.Protocol;

namespace CaiyinSoft.NetGather.NetGatherLib.Filter.Process
{
    public partial class P004_FileDownloadHTMLFilterForm : InnerFormBase
    {
        public P004_FileDownloadHTMLFilterForm()
        {
            InitializeComponent();
        }


        public FileDownloadHTMLFilter _HTMLFilter;
        public FileDownloadHTMLFilter HTMLFilter
        {
            get
            {
                if (_HTMLFilter == null)
                {
                    return null;
                }
                else
                {
                    _HTMLFilter.RunOnce = RunOnce;
                    _HTMLFilter.OutputKey = OutputKey;
                    _HTMLFilter.SavePath = SavePath;
                    return _HTMLFilter;
                }
            }
            set
            {
                _HTMLFilter = value;
                if (value != null)
                {
                    labTitle.Text = value.FilterCaption;
                    txtDescription.Text = value.Description;
                    RunOnce = value.RunOnce;
                    OutputKey = value.OutputKey;
                    SavePath = value.SavePath;
                }
            }
        }

        public bool RunOnce
        {
            get
            {
                return chkRunOnce.Checked;
            }
            set
            {
                chkRunOnce.Checked = value;
            }
        }


        public string OutputKey
        {
            get
            {
                return txtOutKey.Text;
            }
            set
            {
                txtOutKey.Text = value;
            }
        }

        public string SavePath
        {
            get
            {
                return txtSaveTo.Text;
            }
            set
            {
                txtSaveTo.Text = value;
            }
        }
        private void btFile_Click(object sender, EventArgs e)
        {
            DialogResult res= folderBrowserDialog1.ShowDialog();
            if (res != DialogResult.OK) return;
            txtSaveTo.Text = folderBrowserDialog1.SelectedPath;

        }
    }
}
